package com.chinasofti.shoot;

import java.util.Random;

/**
 * 蜜蜂（奖励）
 */
public class Bee extends FlyingObject implements Award {

    private int XSpeed = 1;
    private int YSpeed = 1;
    private int awardType;

    public Bee() {
        image = ShootGame.bee;
        width = image.getWidth();
        height = image.getHeight();
        Random random = new Random();
        x = random.nextInt(ShootGame.WIDTH - this.width);
        y = -this.height;
        y = 0;
        awardType = random.nextInt(1);
    }

    @Override
    public int getType() {
        return awardType;
    }

    @Override
    public void step() {

        x += XSpeed;// x+(向左或向右)
        y += YSpeed;// y+(向下)
        if (x <= 0 || x >= ShootGame.WIDTH - width) {
            XSpeed = -XSpeed;
        }
    }

    @Override
    public boolean outOfBounds() {
        return this.y>ShootGame.HEIGHT;
    }

}
